
	******************************************************************
	**
	**
	**		NAME:		GUY GROSSMAN, YOTAM MARGALIT, TAMAR MITTS
	**		DATE: 		December 15, 2021
	**		PROJECT: 	Israel Hayom
	**		DETAILS: 	This code generates Table SI-12
	**		Version: 	Stata MP 16
	**
	******************************************************************
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**

clear
version 16
set scheme plotplain
set more off

capture cd "~/dropbox/Israeli Newspapers Study/JOP_REPLICATION/Dataverse submission"

* bring in period dataset at locality level

use "Data/yeshuv_period_final_Figs.dta", clear
tsset uniqueid period
sort uniqueid period
	
// define covariates
gl interactions i.period#c.ltd i.period#c.lpop i.period#c.matriccert_pcnt_08 i.period#c.europe_pcnt_08 i.period#c.pop_share1829 i.period#c.pop_share3049 i.period#c.pop_share5065 i.period#c.pop_share66 i.period#c.religion_pcnt i.period#c.asia_pcnt_08
su $interactions

gl covs ltd lpop matriccert_pcnt_08 europe_pcnt_08 pop_share1829 pop_share3049 pop_share5065 pop_share66 asia_pcnt_08 religion_pcnt
su $covs

*****************************************************************
* Regression for the First difference Models (by Election year) *
*****************************************************************

foreach x in BRB {
	bysort uniqueid: gen d`x' = `x'-`x'[_n-1]
	}

estimates drop _all

foreach var in BRB {
	forvalues i = 2(1)4 {

		reg d.`var' d.IHE $covs `var'Pre if period==`i' [aw=potential], cl(area_num)
			estadd local covs "yes"	
			estadd local lag "no"
			estadd local base "yes"
			capture est sto `var'a`i'
			
		reg d.`var' d.IHE L.`var' $covs `var'Pre if period==`i' [aw=potential], cl(area_num)
			estadd local covs "yes"	
			estadd local lag "yes"
			estadd local base "yes"
			capture est sto `var'b`i'	
			
		}
	}

	* Outsheeting results to create Table SI-12
	
	# delimit ;
	esttab BRBa2 BRBb2 BRBa3 BRBb3 BRBa4 BRBb4  
			using "Tables/Table_SI-12.tex", replace
			keep(D.IHE L.BRB _cons)
			cells(b(fmt(%5.3f) star) se(fmt(%5.3f) par))
			starlevels(* .10 ** .05 *** .01) 
			mgroups("\textbf{2009}" "\textbf{2013}" "\textbf{2015}", pattern(1 0 1 0 1 0 )
			span prefix(\multicolumn{@span}{c}{) suffix(}) erepeat(\cmidrule(lr){@span})) nomtitles
			varlabels(D.IHE "$\Delta$ IH exposure"  L.BRB "Right bloc (lagged)" _cons  "Constant")
			stats(covs lag base r2 N, labels("Covariates" "Lag DV"  "Base DV" "R2" "N")
			fmt(0 0 0 2 0)) collabels(none) label booktabs nonotes
			;
			#delimit cr		
